package jl.com.servlet;

import jl.com.controller.ArticeSpiderController;
import jl.com.response.JsonResult;
import jl.com.service.ArticeSpiderService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "SpiderUrlServlet")
public class SpiderUrlServlet extends HttpServlet {
    public SpiderUrlServlet() {
        super();
    }
    public void destroy() {
        super.destroy();
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.doPost(request, response);
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setCharacterEncoding("UTF-8");    //设置响应的字符集格式为UTF-8
        response.setContentType("text/html");  //设置响应正文的MIME类型
        String url = request.getParameter("url");
        int categoryId =Integer.parseInt( request.getParameter("activeId"));
        JsonResult jsonResult = null;
        try {
//              ArticeSpiderService.spiderUrl(url,categoryId);
        }catch (Exception e){
            e.printStackTrace();
        }
        PrintWriter out = response.getWriter();
        out.print(jsonResult);
        out.flush();
        out.close();
    }
}
